home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / oberon / jacob-v0.1 / jacob-v0 / jacob / lib / SysLib.ob2 < prev    next >
Encoding:
Text File  |  1996-04-04  |  5.4 KB  |  151 lines

  1. MODULE SysLib EXTERNAL [""]; 
  2.  
  3. CONST stdin*          = 0;
  4.       stdout*         = 1;
  5.       stderr*         = 2;
  6.              
  7. TYPE  int*            = LONGINT; 
  8.       double*         = LONGREAL;
  9.       size_t*         = LONGINT;
  10.       unsigned_long*  = LONGINT;
  11.       unsigned_short* = INTEGER;
  12.       charP*          = LONGINT;
  13.       voidP*          = LONGINT;
  14.       mode_t*         = LONGINT;
  15.       ptrdiff_t*      = LONGINT;
  16.       time_t*         = LONGINT;
  17.       time_tP*        = LONGINT;
  18.       clock_t*        = LONGINT;
  19.       off_t*          = LONGINT;
  20.  
  21. (* 
  22.  * taken from linux/fcntl.h 
  23.  *
  24.  * open/fcntl - O_SYNC isn't implemented yet
  25.  *)
  26. CONST O_ACCMODE*      = 0003H;
  27.       O_RDONLY*       = 0000H;
  28.       O_WRONLY*       = 0001H;
  29.       O_RDWR*         = 0002H;
  30.       O_CREAT*        = 0040H;       (* not fcntl *)
  31.       O_EXCL*         = 0080H;       (* not fcntl *)
  32.       O_NOCTTY*       = 0100H;       (* not fcntl *)
  33.       O_TRUNC*        = 0200H;       (* not fcntl *)
  34.       O_APPEND*       = 0400H;
  35.       O_NONBLOCK*     = 0800H;
  36.       O_NDELAY*       = O_NONBLOCK;
  37.       O_SYNC*         = 1000H;
  38.  
  39. (*
  40.  * taken from linux/stat.h
  41.  *)
  42. TYPE  struct_statP    = LONGINT;
  43.       struct_stat*    = RECORD
  44.                          st_dev-     : unsigned_short;
  45.                          __pad1-     : unsigned_short;
  46.                          st_ino-     : unsigned_long;
  47.                          st_mode-    : unsigned_short;
  48.                          st_nlink-   : unsigned_short;
  49.                          st_uid-     : unsigned_short;
  50.                          st_gid-     : unsigned_short;
  51.                          st_rdev-    : unsigned_short;
  52.                          __pad2-     : unsigned_short;
  53.                          st_size-    : unsigned_long;
  54.                          st_blksize- : unsigned_long;
  55.                          st_blocks-  : unsigned_long;
  56.                          st_atime-   : unsigned_long;
  57.                          __unused1-  : unsigned_long;
  58.                          st_mtime-   : unsigned_long;
  59.                          __unused2-  : unsigned_long;
  60.                          st_ctime-   : unsigned_long;
  61.                          __unused3-  : unsigned_long;
  62.                          __unused4-  : unsigned_long;
  63.                          __unused5-  : unsigned_long;
  64.                         END;
  65.  
  66. CONST S_IRWXU*        = 1C0H;
  67.       S_IRUSR*        = 100H;
  68.       S_IWUSR*        = 080H;
  69.       S_IXUSR*        = 040H;
  70.  
  71.       S_IRWXG*        = 038H;
  72.       S_IRGRP*        = 020H;
  73.       S_IWGRP*        = 010H;
  74.       S_IXGRP*        = 008H;
  75.  
  76.       S_IRWXO*        = 007H;
  77.       S_IROTH*        = 004H;
  78.       S_IWOTH*        = 002H;
  79.       S_IXOTH*        = 001H;
  80.  
  81. (*----------------------------------------------------------------------------------------------------------------------*)
  82. (*
  83.  * Taken from unistd.h
  84.  *)
  85.  
  86. (* mode flags for access *)
  87. CONST R_OK*           = 4;           (* Test for read permission.    *)
  88.       W_OK*           = 2;           (* Test for write permission.   *)
  89.       X_OK*           = 1;           (* Test for execute permission. *)
  90.       F_OK*           = 0;           (* Test for existence.          *)
  91.  
  92. (* Values for the WHENCE argument to lseek. *)
  93. CONST SEEK_SET*       = 0;           (* Seek from beginning of file. *)
  94.       SEEK_CUR*       = 1;           (* Seek from current position.  *)
  95.       SEEK_END*       = 2;           (* Seek from end of file.       *)
  96.  
  97. (*----------------------------------------------------------------------------------------------------------------------*)
  98. (*
  99.  * taken from linux/times.h
  100.  *)
  101. TYPE  struct_tmsP*    = LONGINT;
  102.       struct_tms*     = RECORD
  103.                          tms_utime-  : clock_t;
  104.                          tms_stime-  : clock_t;
  105.                          tms_cutime- : clock_t;
  106.                          tms_cstime- : clock_t;
  107.                         END; 
  108.  
  109. TYPE  stringP*        = POINTER TO ARRAY 200000000 OF CHAR; 
  110.       ExitProcT*      = PROCEDURE;
  111. VAR   argc*           : LONGINT; 
  112.       argv*           ,
  113.       env*            : POINTER TO ARRAY 200000000 OF stringP; 
  114.       errno*          : LONGINT; 
  115.       ExitProc*       : ExitProcT;      
  116.  
  117. PROCEDURE access*(pathname:charP; mode:int):int; 
  118. PROCEDURE chdir*(path:charP):int; 
  119. PROCEDURE close*(fd:int):int; 
  120. PROCEDURE creat*(pathname:charP; mode:mode_t):int; 
  121. PROCEDURE fstat*(fd:int; buf:struct_statP):int; 
  122. PROCEDURE _fxstat*(ver,fd:int; buf:struct_statP):int; 
  123. PROCEDURE ftruncate*(fd:int; length:size_t):int; 
  124. PROCEDURE lseek*(fd:int; offset:off_t; whence:int):off_t; 
  125. PROCEDURE mkdir*(path:charP; mode:mode_t):int; 
  126. PROCEDURE open*(pathname:charP; flags:int; mode:mode_t):int; 
  127. PROCEDURE read*(fd:int; buf:charP; count:size_t):int; 
  128. PROCEDURE rename*(oldpath:charP; newpath:charP):int; 
  129. PROCEDURE rmdir*(pathname:charP):int; 
  130. PROCEDURE stat*(file_name:charP; buf:struct_statP):int; 
  131. PROCEDURE umask*(mask:int):int; 
  132. PROCEDURE unlink*(pathname:charP):int; 
  133. PROCEDURE write*(fd:int; bufP:charP; count:size_t):int; 
  134.  
  135. PROCEDURE time*(t:time_tP):time_t; 
  136. PROCEDURE times*(buf:struct_tmsP):clock_t; 
  137. PROCEDURE system*(string:charP):int; 
  138. PROCEDURE exit*(status:int); 
  139. PROCEDURE abort*; 
  140. PROCEDURE sbrk*(increment:ptrdiff_t):voidP; 
  141.  
  142. PROCEDURE random*():LONGINT; 
  143. PROCEDURE srandom*(seed:LONGINT); 
  144.  
  145. PROCEDURE gcvt*(number:double; ndigit:size_t; buf:charP); 
  146. PROCEDURE ecvt*(number:double; ndigit:size_t; VAR decpt:int; VAR sign:int):charP; 
  147.  
  148. PROCEDURE strtod*(nptr:charP; VAR endptr:charP):double; 
  149.  
  150. END SysLib.
  151.